<?php

declare(strict_types=1);

namespace DreamCat\StateMachine\Popo;

use DreamCat\StateMachine\Enums\StateHealthLevelEnum;
use DreamCat\StateMachine\Enums\TravelMark;
use DreamCat\StateMachine\Popo\Health\NextActorInfo;

/**
 * 状态机健康检查结果
 * @author vijay
 */
class StateHealthResult
{
    /** @var string 状态机唯一标识，比如病例编号或病例ID */
    private string $machineId;
    /** @var string 当前的状态 */
    private string $state;
    /** @var TravelMark 行进标志 */
    private TravelMark $travelMark;

    /** @var StateHealthLevelEnum 健康状态级别 */
    private StateHealthLevelEnum $healthLevel;
    /** @var string 错误信息描述 */
    private string $message = "ok";
    /** @var NextActorInfo[] 下一个操作信息 */
    private array $nextActorInfoList = [];

    /**
     * @return string
     */
    public function getMachineId(): string
    {
        return $this->machineId;
    }

    /**
     * @param string $machineId
     * @return StateHealthResult
     */
    public function setMachineId(string $machineId): StateHealthResult
    {
        $this->machineId = $machineId;
        return $this;
    }

    /**
     * @return string
     */
    public function getState(): string
    {
        return $this->state;
    }

    /**
     * @param string $state
     * @return StateHealthResult
     */
    public function setState(string $state): StateHealthResult
    {
        $this->state = $state;
        return $this;
    }

    /**
     * @return TravelMark
     */
    public function getTravelMark(): TravelMark
    {
        return $this->travelMark;
    }

    /**
     * @param TravelMark $travelMark
     * @return StateHealthResult
     */
    public function setTravelMark(TravelMark $travelMark): StateHealthResult
    {
        $this->travelMark = $travelMark;
        return $this;
    }

    /**
     * @return StateHealthLevelEnum 健康状态级别
     */
    public function getHealthLevel(): StateHealthLevelEnum
    {
        return $this->healthLevel;
    }

    /**
     * @param StateHealthLevelEnum $healthLevel 健康状态级别
     * @return StateHealthResult
     */
    public function setHealthLevel(StateHealthLevelEnum $healthLevel): StateHealthResult
    {
        $this->healthLevel = $healthLevel;
        return $this;
    }

    /**
     * @return string 错误信息描述
     */
    public function getMessage(): string
    {
        return $this->message;
    }

    /**
     * @param string $message 错误信息描述
     * @return StateHealthResult
     */
    public function setMessage(string $message): StateHealthResult
    {
        $this->message = $message;
        return $this;
    }

    /**
     * @return NextActorInfo[]
     */
    public function getNextActorInfoList(): array
    {
        return $this->nextActorInfoList;
    }

    /**
     * 添加一个下一动作
     * @param NextActorInfo $nextActorInfoList
     * @return StateHealthResult
     */
    public function addNextActorInfo(NextActorInfo $nextActorInfoList): StateHealthResult
    {
        $this->nextActorInfoList[] = $nextActorInfoList;
        return $this;
    }

    /**
     * 清空下一动作的列表
     * @return $this
     */
    public function clearNextActorInfoList(): StateHealthResult
    {
        $this->nextActorInfoList = [];
        return $this;
    }
}

# end of file
